//-
  XXX There is a *lot* of code duplication in the below templates and in the
  corresponding JavaScript components. We will probably need the upcoming #let
  and #each x in y constructors to fix this.

template(name="filterSidebar")
  ul.sidebar-list
    each currentBoard.labels
      li
        a.name.js-toggle-label-filter
          span.card-label.square(class="card-label-{{color}}")
          span.sidebar-list-item-description
            if name
              = name
            else
              span.quiet {{_ "label-default" color}}
          if Filter.labelIds.isSelected _id
            i.fa.fa-check
  hr
  ul.sidebar-list
    each currentBoard.members
      if isActive
        with getUser userId
          li(class="{{#if Filter.members.isSelected _id}}active{{/if}}")
            a.name.js-toggle-member-filter
              +userAvatar(userId=this._id)
              span.sidebar-list-item-description
                = profile.fullname
                | (<span class="username">{{ username }}</span>)
              if Filter.members.isSelected _id
                i.fa.fa-check
  if Filter.isActive
    hr
    a.sidebar-btn.js-clear-all
      i.fa.fa-filter
      span {{_ 'filter-clear'}}
    a.sidebar-btn.js-filter-to-selection
      i.fa.fa-check-square-o
      span {{_ 'filter-to-selection'}}

template(name="multiselectionSidebar")
  ul.sidebar-list
    each currentBoard.labels
      li
        a.name.js-toggle-label-multiselection
          span.card-label.square(class="card-label-{{color}}")
          span.sidebar-list-item-description
            if name
              = name
            else
              span.quiet {{_ "label-default" color}}
          if allSelectedElementHave 'label' _id
            i.fa.fa-check
          else if someSelectedElementHave 'label' _id
            i.fa.fa-ellipsis-h
  hr
  ul.sidebar-list
    each currentBoard.members
      if isActive
        with getUser userId
          li(class="{{#if Filter.members.isSelected _id}}active{{/if}}")
            a.name.js-toggle-member-multiselection
              +userAvatar(userId=this._id)
              span.sidebar-list-item-description
                = profile.fullname
                | (<span class="username">{{ username }}</span>)
              if allSelectedElementHave 'member' _id
                i.fa.fa-check
              else if someSelectedElementHave 'member' _id
                i.fa.fa-ellipsis-h
  hr
  a.sidebar-btn.js-archive-selection
    i.fa.fa-archive
    span {{_ 'archive-selection'}}

template(name="disambiguateMultiLabelPopup")
  p {{_ 'what-to-do'}}
  button.wide.js-remove-label Remove {{_ 'remove-label'}}
  button.wide.js-add-label Add {{_ 'add-label'}}

template(name="disambiguateMultiMemberPopup")
  p {{_ 'what-to-do'}}
  button.wide.js-unassign-member {{_ 'unassign-member'}}
  button.wide.js-assign-member {{_ 'assign-member'}}
